package duixiang.xuesheng;

/**
 * @author げっしょく
 * @date 2021/7/13
 */
public class Customer {
    public static void main(String[] args) {
        Account Jane_Smith = new Account("1000", 2000,1.005);
        Jane_Smith.deposit(100);
        Jane_Smith.withdraw(960);
        Jane_Smith.withdraw(2000);
    }
}


class Account{
    private String id;
    private double balance;
    private double annualInterestRate;

    public Account() {
    }

    public Account(String id, double balance, double annualInterestRate) {
        this.id = id;
        this.balance = balance;
        this.annualInterestRate = annualInterestRate;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }

    public void withdraw(double menoy2){
        if(this.balance < menoy2){
            System.out.println("余额不足，取钱失败");
            return ;
        }
        this.balance -= menoy2;
        System.out.println("取钱成功，您卡内余额为"+this.balance);
    }
    public void deposit(double menoy1){
        if(menoy1 <= 0){
            System.out.println("存钱失败，请输入正确的金额");
            return;
        }
        this.balance += menoy1;
        System.out.println("成功存入"+menoy1);
        System.out.println("您卡内余额为："+this.balance);
    }
}